package com.apes.scm.rcl.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * 功能：日结计划
 *
 * @author xul
 * @create 2019-12-04 16:27
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = RclPlan.CONST_TABLE_NAME)
public class RclPlan extends Model {
    public static final String CONST_TABLE_NAME = "ir_rcl_plan";

    @Id
    @Column(name = "id", nullable = false, length = 10)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "日结计划")
    private String id;

    @Temporal(TemporalType.DATE)
    @Column(name = "start_date")
    @Comment("开始日期")
    private Date startDate;

    @Temporal(TemporalType.DATE)
    @Column(name = "end_date")
    @Comment("结束日期")
    private Date endDate;

    @Temporal(TemporalType.TIME)
    @Column(name = "run_time", nullable = false)
    @Comment("运行时间")
    private Date runTime;

    @Column(name = "valid", nullable = false, columnDefinition = "number(1,0) default 1")
    @Comment("是否有效")
    private boolean valid = true;
}
